<?php
namespace app\admin\controller;

use think\Db;

class Login
{
    public function index()
    {
		session(null);
		$data = array(
			'msg' => ''
		);
		if(request()->isPost()){
			
			$username = input('post.username');
			$password = input('post.password');
			$admin = Db::table('admini')->where(['username'=>$username,'password'=>md5($password)])->find();
			if($admin){
				session("uid",$admin['id']);
				session("aid",$admin['all_aid']);
				session("auth",$admin['auth']);
				session("username",$admin['username']);
				session("type",$admin['type']);
				session("time",time());
				redirect(url('/admin/index'));
				exit();
			}else{
				$data['msg'] = lang('error')['Login_error'];
			}
		}
        return view('',['data'  => $data]);
    }
}
